package shop.services.manage.dictionary.dao.impl;

import shop.core.common.dao.BaseDao;
import shop.core.common.dao.page.PagerModel;
import shop.services.manage.dictionary.bean.Dictionary;
import shop.services.manage.dictionary.dao.DictionaryDao;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

/**
 *字典管理dao层实现
 **/
@Repository("dictionaryDaoManage")
public class DictionaryDaoImpl implements DictionaryDao {
    @Resource
    private BaseDao dao;

    public void setDao(BaseDao dao) {
        this.dao = dao;
    }

    public PagerModel selectPageList(Dictionary e) {
        return dao.selectPageList("manage.dictionary.selectPageList", "manage.dictionary.selectPageCount", e);
    }

    public void updateDictionaryStatus(Dictionary dictionary){
        dao.update("manage.dictionary.updateDictionaryStatus",dictionary);
    }

    @Override
    public int insert(Dictionary e) {
        return dao.insert("manage.dictionary.insert", e);
    }

    @Override
    public int delete(Dictionary e) {
        return dao.delete("manage.dictionary.delete", e);
    }

    @Override
    public int update(Dictionary e) {
        return dao.update("manage.dictionary.update", e);
    }

    @Override
    public Dictionary selectOne(Dictionary e) {
        return (Dictionary) dao.selectOne("manage.dictionary.selectOne", e);
    }

    @Override
    public List selectList(Dictionary e) {
        return dao.selectList("manage.dictionary.selectList", e);
    }

    @Override
    public int deleteById(int id) {
        return dao.delete("manage.dictionary.deleteById", id);
    }

    @Override
    public Dictionary selectById(String id) {
        return (Dictionary) dao.selectOne("manage.dictionary.selectById",id);
    }
}
